﻿
Option Strict On : Option Explicit On : Option Compare Binary : Option Infer On

Imports System
Imports System.Collections.ObjectModel
Imports System.Text.RegularExpressions


Namespace Code.Coloriser

    ''' <summary>
    ''' Default code coloriser for C
    ''' </summary>
    ''' <remarks></remarks>
    Friend Class CCodeColoriser
        Inherits IColorTokenProvider

        'Sub New()
        '    'Me.Keywords = New String() {"auto", "break", "case", "cdecl", "char", "const", _
        '    '                            "continue", "default", "do", "double", "else", _
        '    '                            "enum", "extern", "far", "float", "for", "fortran", _
        '    '                            "goto", "huge", "if", "int", "interrupt", "long", _
        '    '                            "near", "pascal", "register", "return", "short", "signed", _
        '    '                            "sizeof", "static", "struct", "switch", "typedef", _
        '    '                            "union", "unsigned", "void", "volatile", "while"}

        '    'Me.m_stringOrCharRegexStr = "("".*?"")|('.*?')"
        '    'Me.m_commentRegexStr = "//.*|/\*.*?\*/"
        'End Sub


        Public Overrides ReadOnly Property CaseSensitive() As Boolean
            Get
                Return True
            End Get
        End Property


        Protected Overrides ReadOnly Property CommentRegexStr() As String
            Get
                Return "(/\*.*?\*/|//[^\r\n]*)"
            End Get
        End Property


        Protected Overrides ReadOnly Property StringOrCharRegexStr() As String
            Get
                Return """""|""[^\r\n]*?(?!\\).""|''|'[^\r\n]*?(?!\\).'"
            End Get
        End Property


        Protected Overrides ReadOnly Property Keywords() As String
            Get
                Return "auto break case cdecl char const " _
                & "continue default do double else " _
                & "enum extern far float for fortran " _
                & "goto huge if int interrupt long " _
                & "near pascal register return short signed " _
                & "sizeof static struct switch typedef " _
                & "union unsigned void volatile while"
            End Get
        End Property


        Protected Overrides ReadOnly Property Preprocessors() As String
            Get
                Return ""
            End Get
        End Property

    End Class

End Namespace





